<?php

namespace App\Admin\Controllers;

use App\Biz\UploadedBiz;
use App\Biz\VisitorReservesBiz;
use App\Http\Controllers\Controller;
use Dcat\Admin\Admin;
use Dcat\Admin\Traits\HasUploadedFile;
use Illuminate\Support\Str;

class ImageController extends Controller
{
    use HasUploadedFile;

    protected UploadedBiz $uploadedBiz;

    /**
     * @param UploadedBiz $uploadedBiz
     */
    public function __construct(UploadedBiz $uploadedBiz)
    {
        $this->uploadedBiz = $uploadedBiz;
    }


    public function handle()
    {
        // 判断是否是删除文件请求
        if ($this->isDeleteRequest()) {
            // 删除文件并响应
            return Admin::json();
            return $this->deleteFileAndResponse($disk);
        }
        return $this->uploadedBiz->imageUpload();
    }
}
